package com.study.commen

import android.os.Bundle
import android.text.TextUtils
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.study.commen.utils.StatusBarUtils

abstract class BaseActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(initLayout())
        initView()
        initListener()
    }

    abstract fun initLayout(): Int
    fun tintStatusBar(color: String) {
        if (!TextUtils.isEmpty(color)) {
            StatusBarUtils.tintColor(this, color, ContextCompat.getColor(this, R.color.white))
        }else{
            StatusBarUtils.tintColor(this, "#000000", ContextCompat.getColor(this, R.color.white))
        }
    }

    abstract fun initView()
    abstract fun initListener()

}